<?php
namespace app\common\model;
use think\Model;
class MemberInfo extends Model
{

    // 表名
    protected $name = 'memberinfo';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    // 追加属性
    protected $append = [];
    public function memberlogin()
    {
       return $this->hasOne('MemberLogin','itemid','memberid');
    }
    public function getInfo($memberid = 0){
        $minfo = $this->get(['memberid'=>$memberid]);
        $mrinfo = array();
        $mrinfo['itemid'] = $minfo['itemid'];
        $mrinfo['content'] = $minfo['content'];
        $mrinfo['credit'] = $minfo['credit'];
        $mrinfo['provinceid'] = $minfo['provinceid'];
        $mrinfo['cityid'] = $minfo['cityid'];
        $mrinfo['areaid'] = $minfo['areaid'];
        $mrinfo['message'] = $minfo['message'];
        $mrinfo['qq'] = $minfo['qq'];
        $mrinfo['avatar'] = $minfo['avatar'];
        $mrinfo['phone'] = $minfo['phone'];
        $mrinfo['gender'] = $minfo['gender'];
        $mrinfo['truename'] = $minfo['truename'];
        $mrinfo['nickname'] = $minfo['nickname'];
        $mrinfo['memberid'] = $memberid;
        //print_r($mrinfo);exit;
        return $mrinfo;
    }
}
